package com.joe.other.excel;

import com.alibaba.excel.EasyExcel;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.util.List;
import java.util.Map;

public class EasyExcelReadTest {

    private static final Logger logger = LoggerFactory.getLogger(EasyExcelReadTest.class);

    public static void main(String[] args) {
        String fileName1 = "/Users/Joe/Downloads/00000000.xlsx";
        File f1 = new File(fileName1);
        logger.info("文件大小：{}",f1.length());

        String fileName = "/Users/Joe/Downloads/0000.xlsx";
        File f = new File(fileName);
        logger.info("文件大小：{}",f.length());
        List<Map<Integer, String>> objects = EasyExcel.read(f).sheet().doReadSync();
        System.out.println(objects.size());
        for (Map<Integer, String> object : objects) {
            for (int i = 0; i < object.size(); i++) {
                String o = object.get(i);
                if (StringUtils.isBlank(o)) {
                    System.out.println("");
                } else {
                    System.out.print(o);
                }
                System.out.print("\r");
            }
            System.out.println();
        }

    }


}
